#ifndef _TITLE_H
#define _TITLE_H

#include<iostream.h>
#include "CPstring.h"
#include "wordlist.h"
#include "ktitle.h"
#include "vector.h"

// **********************************************
// In this file not all private section data/functions
// are provided!!
// **********************************************
//
// Kwic (Key Word in Context) title class
//
// Owen Astrachan and Michael Loeb
// 2/6/97
//
// a title is a collection of words, e.g., "The Sun Also Rises"
//                                         "Woman on the Edge of Time"
// a title is built from a string
// of white-space delimited words which are parsed into individual
// words (although clients do not have access to individual words)
// e.g.,
//          Title t;
//          t.Build("The Sun Also Rises",dictionary);
// 
// will result in t representing, internally "The" "Sun" "Also" "Rises";
// building a title also requires a dictionary in which strings are stored.
// The Title maintains pointers to these strings, but does not store
// the strings themselves
// 
// member functions
//
// Title()
//        -- construct an empty title
//
// Build(const string & line, WordList * wlist)
//
//        -- build a title from line: line represents a sequence
//           of white-space delimited words: "Woman on the Edge of Time"
//           wlist is a list of words -- words are stored here, and
//           the title maintains pointers to the stored words rather
//           than maintaining the words themselves
//
// void Less(const Title & rhs) const
//
//       -- returns true iff Title rhs less than self.  Less than
//          works left-to-right, comparing each word lexicographically
//
// void Print(ostream & out) const
//
//       -- prints a title in a reasonable way.  This function is
//          used mostly for debugging, KwicTitles are usually
//          printed rather than titles
//
// void MakeKwic(Vector<KwicTitle> & list, int & numElts,
//               WordList * ignores)
// 
//       -- builds a list of all KwicTitles from a title, the
//          list, and count of # KwicTitles, are returned via
//          parameters list and numElts.  The parameter ignores
//          specifies which words are NOT keywords.  Any element
//          of ignores is NOT considered a keyword
//
// FRIEND:  the class KwicTitle is declared as a friend so that
//          the KwicTitle class can access individual words in a
//          Title (and other classes/clients cannot)


class Title
{
  public:
    Title();

    void Build(const string & line, WordList * wlist);      // make a title
    void MakeKwic(Vector<KwicTitle> & list,                 // make all
		  int & numElts, WordList * ignores);       // kwic titles

    bool Less(const Title & rhs) const;                     // compare <
    void Print(ostream & out) const;                        // print

    friend class KwicTitle;                                 // access words
    
  private:

};

// overload operators for easier use of Less/Print

bool operator < (const Title & lhs, const Title & rhs);
ostream & operator << (ostream & os, const Title & t);
    
#endif
